<?php
	//echo print_r($profile);
//    echo $form->create('User', array('action' => '../users/uprofile/'.$profile['User']['id']));
//    echo $form->input('User.email_address', array('value' => $profile['User']['email_address']));
//    echo $form->input('User.fname', array('value' => $profile['User']['fname']));
//    echo $form->input('User.lname', array('value' => $profile['User']['lname']));
//    echo $form->input('User.hphone', array('value' => $profile['User']['hphone']));
//    echo $form->input('User.wphone', array('value' => $profile['User']['wphone']));
//    echo $form->input('User.cphone', array('value' => $profile['User']['cphone']));
//    echo $form->end('Save Profile');
?>
<div class="center" >
    <?php echo $form->create('User', array('action' => '../users/uprofile/'.$profile['User']['id'])); ?>
                <h3>User Account Management</h3>
                <hr />
                <!-- the tabs -->
                <div class="tabbed-pane">
                    <ul class="tabs">
                        <li><a href="#">User Information</a></li>
                        <li><a href="#">Assigned Skills</a></li>
                        <li><a href="#">Availability</a></li>
                        <li><a href="#">Password Reset</a></li>
                        <li><a href="#">Delete User</a></li>
                        
                    </ul>

                    <!-- tab "panes" -->
                    <div class="panes clearfix">
                        <section>
                        <fieldset class="form grid_6">
                            <?php echo $form->input('User.email_address', array('value' => $profile['User']['email_address'], 'label' => 'Email Address/Login'));?>
                            <?php echo $form->input('User.fname', array('label' => 'First Name', 'value' => $profile['User']['fname']));?>
                            <?php echo $form->input('User.lname', array('label' => 'Last Name', 'value' => $profile['User']['lname']));?>                                                        
                            <?php echo $form->input('User.hphone', array('label' => 'Home Phone', 'value' => $profile['User']['hphone']));?>
                            <?php echo $form->input('User.cphone', array('label' => 'Cell Phone', 'value' => $profile['User']['cphone']));?>
                            <?php echo $form->input('User.wphone', array('label' => 'Work Phone', 'value' => $profile['User']['wphone'])); ?>
                            <?php echo $form->input('Group.id', array('label' => 'Group','type' => 'select', 'options' => $grp, 'selected' => $profile['Group'][0]['id']));?>
                            <?php $opts = array('0' => 'Inactive', '1' => 'Active');
                                echo $form->input('User.active', array('options' => $opts, 'type' => 'select', 'label' => 'Status', 'selected' => $profile['User']['active'])); ?> 
                            <?php //echo pr($profile);//echo pr($grp); ?> 
                        </fieldset>
                        </section>
                        <section>
                        <fieldset>
                            
                            <div id="skillwrapper">
                            <?php 
                                    //echo pr($selected);
                                    $options = array();
                                    $selected = array();
                                    foreach($skill as $sk)
                                    {
                                       $options[$sk['Skill']['id']] = $sk['Skill']['name'];              
                                    }
                                    foreach ($profile['Skill'] as $sk)
                                    {
                                        $selected[] = $sk['id'];
                                    }
                                    echo $form->input('Skill', array('label' => '', 'multiple' => 'checkbox', 'options' => $options, 'selected' => $selected));
                            ?>
                            </div>
                        </fieldset>

                        </section>
                        <section>
                        <fieldset>
                            
                        <div id="availablewrapper">
                        <?php
                        $options = array();
                        $selected = array();
                        foreach($avail as $av)
                        {
                            $options[$av['Available']['id']] = $av['Available']['avail_day'] . ' ' . $av['Available']['avail_time'];
                        }
                        foreach ($profile['Available'] as $av)
                                    {
                                        $selected[] = $av['id'];
                                    }
                        echo $form->input('Available', array('label' => '', 'multiple' => 'checkbox', 'options' => $options, 'selected' => $selected));
                        ?>
                        </div>
                        </fieldset>
                        </section>
                        <section>
                        <fieldset class="form grid_6">
                           <div style="text-align: center;">
                           This will reset the users' password to random characters and email it to them. Make sure that the user e-mail/login information is correct.     
                           <br /><br />
                           <?php echo $form->button('<span class="page_white_edit"></span>Reset User Password', array('class' => 'button button-gray accept', 'onclick' => 'if(confirm(\'Are you sure you want to reset the user password?\')) location.href=\'' . $this->Html->url('/users/sendnewpass/'.$profile['User']['id']) . '\'' , 'type' => 'button')); ?>
                           </div>
                        </fieldset>
                        </section>
                        <section>
                        <fieldset class="form grid_6">
                        <div style="text-align: center;">
                            <?php echo $form->button('<span class="bin"></span>Delete User', array('class' => 'button button-gray accept', 'onclick' => 'if(confirm(\'Are you sure you want to delete this user?\')) location.href=\'' . $this->Html->url('/users/udelete/'.$profile['User']['id']) . '\'' , 'type' => 'button')); ?>
                        </div>
                        </fieldset>
                        </section>
                    </div>
                </div>
            </div>
<section class="container_6 clearfix">
    
    </fieldset>
    
    <fieldset class="form grid_6">        
        <div >
        <?php echo $form->button('<span class="accept"></span>Save Profile', array('class' => 'button button-gray accept')); ?>
        <?php echo $form->end(); ?>
        </div>
    </fieldset>

    
        
    
    </fieldset>
    <!--</form>-->


</section>